#include <iostream>
#define N 100

using namespace std;

void readintVector(int array[], int elements){
for (int i=0; i<elements; i++){
	cout<<"a["<<i<<"]=";
	cin>>array[i];
	cout<<"\n";}
}
int insert_zero(int array[], int elements){
int i, j, zero=elements;
for(i=1;i<elements;i++)
	if (array[i]!=0)
		if (array[i-1]!=0 && array[i+1]!=0){
			for (j=elements;j>i;--j)
				array[j]=array[j-1];				
			array[i]=0;
			++elements;}
return elements;
}

void printintVector(int array[], int zero){
for (int i=0; i<zero; i++){
	cout<<array[i]<<" ";}
	cout<<"\n";
}


int main(){
int array[N];
int elements,zero;
cout<<"Type the number of elements you want in the array: ";
cin>>elements;
readintVector(array, elements);

cout<<"The original array is ";
for(int i=0; i<elements; i++){
	cout<<array[i]<<" ";}
cout<<endl;
zero=insert_zero(array, elements);
cout<<"The array with 0 inserted is ";
printintVector(array, zero);
return 0;
}

